]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
panel: Block banners when opening menus that would overlap
authorMeet Parikh <meetprkh.gnome@gmail.com>
Thu, 23 Apr 2015 16:43:58 +0000 (22:13 +0530)
committerFlorian Müllner <fmuellner@gnome.org>
Sat, 25 Apr 2015 07:56:05 +0000 (09:56 +0200)
We currently block banners while the time+date menu is open, as it
would obscure the notification. However it is not necessarily the
only menu for which this is the case, so generalize the behavior
to all menus that would overlap banners when open.

https://bugzilla.gnome.org/show_bug.cgi?id=745910

js/ui/dateMenu.js
js/ui/panel.js

index 7307d7d8f34881cc196b3bbdadb1f68936430ec4..12d7eea157dde4302baa631160b4601a32b6ca7e 100644 (file)
@@ -357,8 +357,6 @@ const DateMenuButton = new Lang.Class({
                 this._date.setDate(now);
                 this._messageList.setDate(now);
             }
-            // Block notification banners while the menu is open
-            Main.messageTray.bannerBlocked = isOpen;
         }));
 
         // Fill up the first column
index 2a951368f20d206446fdd68c804a88025570e329..46be6acca0e490e0f97c5ce0143177f276263093 100644 (file)
@@ -1003,6 +1003,25 @@ const Panel = new Lang.Class({
         if (parent)
             parent.remove_actor(container);
 
+        if (indicator._openChangedId > 0)
+            indicator.menu.disconnect(indicator._openChangedId);
+        indicator._openChangedId = 0;
+
+        if (indicator.menu)
+            indicator._openChangedId = indicator.menu.connect('open-state-changed',
+                Lang.bind(this, function(menu, isOpen) {
+                    let boxAlignment;
+                    if (box == this._leftBox)
+                        boxAlignment = Clutter.ActorAlign.START;
+                    else if (box == this._centerBox)
+                        boxAlignment = Clutter.ActorAlign.CENTER;
+                    else if (box == this._rightBox)
+                        boxAlignment = Clutter.ActorAlign.END;
+
+                    if (boxAlignment == Main.messageTray.bannerAlignment)
+                        Main.messageTray.bannerBlocked = isOpen;
+                }));
+
         box.insert_child_at_index(container, position);
         if (indicator.menu)
             this.menuManager.addMenu(indicator.menu);